<!DOCTYPE html>
<html xmlns:th="http://www.w3.org/1999/xhtml">

<head>
    <!-- 页面meta -->
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <title>商家审核</title>
    <!-- Tell the browser to be responsive to screen width -->
    <meta content="width=device-width,initial-scale=1,maximum-scale=1,user-scalable=no" name="viewport">
    <link rel="stylesheet" href="/plugins/bootstrap/css/bootstrap.min.css">
    <link rel="stylesheet" href="/plugins/adminLTE/css/AdminLTE.css">
    <link rel="stylesheet" href="/plugins/adminLTE/css/skins/_all-skins.min.css">
    <link rel="stylesheet" href="/css/style.css">
	<script src="/plugins/jQuery/jquery-2.2.3.min.js"></script>
    <script src="/plugins/bootstrap/js/bootstrap.min.js"></script>
	<div th:insert="/common.html"></div>
</head>

<body class="hold-transition skin-red sidebar-mini"  >
  <!-- .box-body -->
                <div class="box box-primary">
					<input type="hidden" name="sellerId">
                    <div class="box-header with-border">
                        <h3 class="box-title">商家审核</h3>
                    </div>

                    <div class="box-body">

                        <!-- 数据表格 -->
                        <div class="table-box">

                            <!--工具栏-->
                            
                            <div class="box-tools pull-right">
                                <div class="has-feedback">
									公司名称：<input type="text" name="name">
									店铺名称： <input  type="text" name="nickName">
									<button class="btn btn-default" onclick="query()" >查询</button>
                                </div>
                            </div>
                            <!--工具栏/-->

			                  <!--数据列表-->
			                  <table id="dataList" class="table table-bordered table-striped table-hover dataTable">
			                      <thead>
			                          <tr>
			                              <th class="" style="padding-right:0px">
			                                  <input id="selall" type="checkbox" class="icheckbox_square-blue">
			                              </th> 
										  <th class="sorting_asc">商家ID</th>
									      <th class="sorting">公司名称</th>
									      <th class="sorting">店铺名称</th>
									      <th class="sorting">联系人姓名</th>
									      <th class="sorting">公司电话</th>
									     							
					                      <th class="text-center">操作</th>
			                          </tr>
			                      </thead>
			                      <tbody>
			                          <tr>
			                              <td><input  type="checkbox"></td>			                              
				                          <td>1</td>
									      <td>梦琪琪商贸有限公司</td>
									      <td>梦琪琪</td>
									      <td>李梦琪</td>
									      <td>13402312232</td>
		                                 
		                                  <td class="text-center">                                           
		                                 	  <button type="button" class="btn bg-olive btn-xs" data-toggle="modal" data-target="#sellerModal" >详情</button>                                           
		                                  </td>
			                          </tr>
									  <tr>
			                              <td><input  type="checkbox"></td>			                              
				                          <td>2</td>
									      <td>黑瞎子苹果专卖店</td>
									      <td>黑瞎子</td>
									      <td>孙大鹏</td>
									      <td>13622244111</td>
		                                  
		                                  <td class="text-center">                                           
		                                 	  <button type="button" class="btn bg-olive btn-xs" data-toggle="modal" data-target="#sellerModal" >详情</button>                                           
		                                  </td>
			                          </tr>
			                      </tbody>
			                  </table>
			                  <!--数据列表/-->
                        </div>
                        <!-- 数据表格 /-->
                     </div>
                    <!-- /.box-body -->
<!-- 商家详情 -->
<div class="modal fade" id="sellerModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
  <div class="modal-dialog modal-lg" >
	<div class="modal-content">
		<div class="modal-header">
			<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
			<h3 id="myModalLabel">商家详情</h3>
		</div>
	</div>
		<div class="modal-body">							
			
			 <ul class="nav nav-tabs">
			  <li class="active"><a href="#home" data-toggle="tab">基本信息</a></li>
			  <li><a href="#linkman" data-toggle="tab">联系人</a></li>
			  <li><a href="#certificate" data-toggle="tab">证件</a></li>
			  <li><a href="#ceo" data-toggle="tab">法定代表人</a></li>
			  <li><a href="#bank" data-toggle="tab">开户行</a></li>
			</ul>							
			
			<!-- 选项卡开始 -->         
		    <div id="myTabContent" class="tab-content">
			    <div class="tab-pane active in" id="home">
			      <br>
			      <table class="table table-bordered table-striped"  width="800px">
			      	<tr>
			      		<td>公司名称</td>
			      		<td id="name"></td>
			      	</tr>
			      	<tr>
			      		<td>公司手机</td>
			      		<td id="mobile"></td>
			      	</tr>
			      	<tr>
			      		<td>公司电话</td>
			      		<td id="telephone"></td>
			      	</tr>
			      	<tr>
			      		<td>公司详细地址</td>
			      		<td id="address_detail"></td>
			      	</tr>
			      </table>			      
      			</div>	
			    <div class="tab-pane fade" id="linkman">
			    	<br>
					<table class="table table-bordered table-striped" >
			      	<tr>
			      		<td>联系人姓名</td>
			      		<td id="linkman_name"></td>
			      	</tr>
			      	<tr>
			      		<td>联系人QQ</td>
			      		<td id="linkman_qq"></td>
			      	</tr>
			      	<tr>
			      		<td>联系人手机</td>
			      		<td id="linkman_mobile"></td>
			      	</tr>
			      	<tr>
			      		<td>联系人E-Mail</td>
			      		<td id="linkman_email"></td>
			      	</tr>
			      </table>
			    </div>
			    <div class="tab-pane fade" id="certificate">
					<br>
					<table class="table table-bordered table-striped" >
				      	<tr>
				      		<td>营业执照号</td>
				      		<td id="license_number"></td>
				      	</tr>
				      	<tr>
				      		<td>税务登记证号</td>
				      		<td id="tax_number"></td>
				      	</tr>
				      	<tr>
				      		<td>组织机构代码证号</td>
				      		<td id="org_number"></td>
				      	</tr>				      	
			     	</table>
			    </div>
			    <div class="tab-pane fade" id="ceo">
					<br>
					<table class="table table-bordered table-striped" >
				      	<tr>
				      		<td>法定代表人</td>
				      		<td id="legal_person"></td>
				      	</tr>
				      	<tr>
				      		<td>法定代表人身份证号</td>
				      		<td id="legal_person_card_id"></td>
				      	</tr>					   			      	
			     	</table>
			    </div>
			    <div class="tab-pane fade" id="bank">
					<br>
					<table class="table table-bordered table-striped" >
				      	<tr>
				      		<td>开户行名称</td>
				      		<td id="bank_user"></td>
				      	</tr>
				      	<tr>
				      		<td>开户行支行</td>
				      		<td id="bank_name"></td>
				      	</tr>		
				      	<tr>
				      		<td>银行账号</td>
				      		<td id="bank_card"></td>
				      	</tr>			   			      	
			     	</table>					
			    </div>
			</div>
           <!-- 选项卡结束 -->          
		</div>
		<div class="modal-footer">						
			<button onclick="examineYes()" class="btn btn-success" data-dismiss="modal" aria-hidden="true">审核通过</button>
         	<button onclick="examineNo()" class="btn btn-danger"  data-dismiss="modal" aria-hidden="true">审核未通过</button>
            <button onclick="closeShop()" class="btn btn-danger" data-dismiss="modal" aria-hidden="true">关闭商家</button>
			<button class="btn btn-default" data-dismiss="modal" aria-hidden="true">关闭</button>
		</div>
	  </div>
	</div>
</div>

</body>
<script type="text/javascript">
	$('#dataList').bootstrapTable({
		url: "/seller/selectInfoLimitServer", //请求后台的URL（*）
		method: 'get',                      //请求方式（*）
		// contentType: "application/x-www-form-urlencoded",/*使用post*/
		// toolbar: '#sdfname',              //工具按钮用哪个容器
		striped: true,                      //是否显示行间隔色
		cache: false,                       //是否使用缓存，默认为true，所以一般情况下需要设置一下这个属性（*）
		pagination: true,                   //是否显示分页（*）
		sidePagination: "server",           //分页方式：client客户端分页，server服务端分页（*）
		pageNumber: 1,                      //初始化加载第一页，默认第一页,并记录
		pageSize: 5,                        //每页的记录行数（*）
		pageList: [1, 3, 5],                //可供选择的每页的行数（*）
		showColumns: true,                  //是否显示所有的列（选择显示的列）
		showRefresh: true,                  //是否显示刷新按钮
		minimumCountColumns: 1,             //最少允许的列数
		clickToSelect: true,                //是否启用点击选中行
		showToggle: true,                   //是否显示详细视图和列表视图的切换按钮
		detailView: true,                  //是否显示父子表
		//得到查询的参数
		queryParams : function (params) {
			//这里的键的名字和控制器的变量名必须一致，这边改动，控制器也需要改成一样的
			var temp = {
				pageSize: params.limit,
				//页面大小
				pageNumber: (params.offset / params.limit) + 1 ,  //页码
				name: $("[name='name']").val(),
				nickName: $("[name='nickName']").val()
			};
			return temp;
		},
		columns: [{
			checkbox: true,
			visible: false                  //是否显示复选框
		}, {
			field: 'sellerId',
			title: '商家ID'
		}, {
			field: 'name',
			title: '公司名称'
		}, {
			field: 'nickName',
			title: '店铺名称'
		},{
			field: 'linkmanName',
			title: '联系人姓名'
		},{
			field: 'telephone',
			title: '公司电话'
		},{
			field: 'status',
			title: '状态',
			formatter:function (value, row, index) {
				if (value==0){
					return "待审核";
				}else if (value == 1){
					return "审核通过";
				}else if (value == 2){
					return "审核不通过";
				}else if (value == 3){
					return "关闭账户";
				}
			}
		},{
			field:'sellerId',
			title: '操作',
			width: 120,
			align: 'center',
			valign: 'middle',
			formatter: function (value, row, index) {
				var id = value;
				var result = "";
				result += '<button onclick="examine(&quot;'+id+'&quot;)" type="button" class="btn bg-olive btn-xs" data-toggle="modal" data-target="#sellerModal" >详情</button>  ';
				result += "<a href='javascript:DeleteById(" + id + ")' class='btn btn-xs red' title='删除'><span class='glyphicon glyphicon-remove'></span></a>";
				return result;
			}
		}
		],
		onLoadError: function () {
			toastr.error("数据加载失败！");
		},onDblClickRow: function (row, $element) {//双击事件
		}
	})
	/*查询*/
	function query() {
		$("#dataList").bootstrapTable("refresh");
	}
	function examine(id) {
		$("[name='sellerId']").val(id);
		$.ajax({
			url: "/seller/getTbSellerBySellerId",
			dataType: "json",
			type: "post",
			data: {sellerId:id},
			async:false,
			success:function (result) {
				if (result.code == 10000) {
					var seller = result.data;
					$("#name").text(seller.name);
					$("#mobile").text(seller.mobile);
					$("#telephone").text(seller.telephone);
					$("#address_detail").text(seller.addressDetail);
					$("#linkman_name").text(seller.linkmanName);
					$("#linkman_qq").text(seller.linkmanQq);
					$("#linkman_mobile").text(seller.linkmanMobile);
					$("#linkman_email").text(seller.linkmanEmail);
					$("#license_number").text(seller.licenseNumber);
					$("#tax_number").text(seller.taxNumber);
					$("#org_number").text(seller.orgNumber);
					$("#legal_person").text(seller.legalPerson);
					$("#legal_person_card_id").text(seller.legalPersonCardId);
					$("#bank_user").text(seller.bankUser);
					$("#bank_name").text(seller.bankName);
					$("#bank_card").text(seller.bankCard);
				}else if (result.code == 9999){
					alert(result.message)
				}
			},error:function (result) {
				alert(result.message)
			}
		})
	}
	function examineYes() {
		$.ajax({
			url: "/seller/statusSeller",
			dataType: "json",
			type: "post",
			data: {
				status:'1',
				sellerId:$("[name='sellerId']").val()
			},
			async:false,
			success:function (result) {
				if (result.code == 10011){
					query();
					toastr.success(result.message)
				}else if(result.code == 10011){
					toastr.error(result.message)
				}
			},error:function (result) {
				alert(result.message)
			}
		})
	}
	function examineNo() {
		$.ajax({
			url: "/seller/statusSeller",
			dataType: "json",
			type: "post",
			data: {
				status:'2',
				sellerId:$("[name='sellerId']").val()
			},
			async:false,
			success:function (result) {
				if (result.code == 10011){
					query();
					toastr.success(result.message)
				}else if(result.code == 10011){
					toastr.error(result.message)
				}
			},error:function (result) {
				alert(result.message)
			}
		})
	}
	function closeShop() {
		$.ajax({
			url: "/seller/statusSeller",
			dataType: "json",
			type: "post",
			data: {
				status:'3',
				sellerId:$("[name='sellerId']").val()
			},
			async:false,
			success:function (result) {
				if (result.code == 10011){
					query();
					toastr.success(result.message)
				}else if(result.code == 10011){
					toastr.error(result.message)
				}
			},error:function (result) {
				alert(result.message)
			}
		})
	}
</script>
</html>